package com.ffcs.crm.intf.webServiceClient.forPoc;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class PocDealWithHandleImplServiceLocator extends org.apache.axis.client.Service implements com.ffcs.crm.intf.webServiceClient.forPoc.PocDealWithHandleImplService {

    public PocDealWithHandleImplServiceLocator() {
        initAddress();
    }


    public PocDealWithHandleImplServiceLocator(org.apache.axis.EngineConfiguration config) {
        super(config);
        initAddress();
    }

    public PocDealWithHandleImplServiceLocator(java.lang.String wsdlLoc, javax.xml.namespace.QName sName) throws javax.xml.rpc.ServiceException {
        super(wsdlLoc, sName);
        initAddress();
    }

    //poc  ..
    private java.lang.String IPocHandle_address = "http://134.128.51.11:8333/sp/services/IPocHandle";
    public void initAddress(){
        Properties prop = new Properties(); 
        InputStream in = null; 
        try { 
            in=PocDealWithHandleImplServiceLocator.class.getResourceAsStream("/sp-server.properties");
            prop.load(in); 
            IPocHandle_address=prop.getProperty("sp.server.url");
//            System.out.println(" IPocHandle_address= "+IPocHandle_address);
        } catch (IOException e) { 
            e.printStackTrace(); 
        } finally{
            if (in != null) {
                try {
                    in.close();
                } catch (Exception e) {
                }
            }
        }
    }
    public java.lang.String getIPocHandleAddress() {
        return IPocHandle_address;
    }

    // The WSDD service name defaults to the port name.
    private java.lang.String IPocHandleWSDDServiceName = "IPocHandle";

    public java.lang.String getIPocHandleWSDDServiceName() {
        return IPocHandleWSDDServiceName;
    }

    public void setIPocHandleWSDDServiceName(java.lang.String name) {
        IPocHandleWSDDServiceName = name;
    }

    public com.ffcs.crm.intf.webServiceClient.forPoc.PocDealWithHandleImpl getIPocHandle() throws javax.xml.rpc.ServiceException {
       java.net.URL endpoint;
        try {
            endpoint = new java.net.URL(IPocHandle_address);
        }
        catch (java.net.MalformedURLException e) {
            throw new javax.xml.rpc.ServiceException(e);
        }
        return getIPocHandle(endpoint);
    }

    public com.ffcs.crm.intf.webServiceClient.forPoc.PocDealWithHandleImpl getIPocHandle(java.net.URL portAddress) throws javax.xml.rpc.ServiceException {
        try {
            com.ffcs.crm.intf.webServiceClient.forPoc.IPocHandleSoapBindingStub _stub = new com.ffcs.crm.intf.webServiceClient.forPoc.IPocHandleSoapBindingStub(portAddress, this);
            _stub.setPortName(getIPocHandleWSDDServiceName());
            return _stub;
        }
        catch (org.apache.axis.AxisFault e) {
            return null;
        }
    }

    public void setIPocHandleEndpointAddress(java.lang.String address) {
        IPocHandle_address = address;
    }

    /**
     * For the given interface, get the stub implementation.
     * If this service has no port for the given interface,
     * then ServiceException is thrown.
     */
    public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
        try {
            if (com.ffcs.crm.intf.webServiceClient.forPoc.PocDealWithHandleImpl.class.isAssignableFrom(serviceEndpointInterface)) {
                com.ffcs.crm.intf.webServiceClient.forPoc.IPocHandleSoapBindingStub _stub = new com.ffcs.crm.intf.webServiceClient.forPoc.IPocHandleSoapBindingStub(new java.net.URL(IPocHandle_address), this);
                _stub.setPortName(getIPocHandleWSDDServiceName());
                return _stub;
            }
        }
        catch (java.lang.Throwable t) {
            throw new javax.xml.rpc.ServiceException(t);
        }
        throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface:  " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
    }

    /**
     * For the given interface, get the stub implementation.
     * If this service has no port for the given interface,
     * then ServiceException is thrown.
     */
    public java.rmi.Remote getPort(javax.xml.namespace.QName portName, Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
        if (portName == null) {
            return getPort(serviceEndpointInterface);
        }
        java.lang.String inputPortName = portName.getLocalPart();
        if ("IPocHandle".equals(inputPortName)) {
            return getIPocHandle();
        }
        else  {
            java.rmi.Remote _stub = getPort(serviceEndpointInterface);
            ((org.apache.axis.client.Stub) _stub).setPortName(portName);
            return _stub;
        }
    }

    public javax.xml.namespace.QName getServiceName() {
        return new javax.xml.namespace.QName("http://localhost:7001/sp/services/IPocHandle", "PocDealWithHandleImplService");
    }

    private java.util.HashSet ports = null;

    public java.util.Iterator getPorts() {
        if (ports == null) {
            ports = new java.util.HashSet();
            ports.add(new javax.xml.namespace.QName("http://localhost:7001/sp/services/IPocHandle", "IPocHandle"));
        }
        return ports.iterator();
    }

    /**
    * Set the endpoint address for the specified port name.
    */
    public void setEndpointAddress(java.lang.String portName, java.lang.String address) throws javax.xml.rpc.ServiceException {
        
if ("IPocHandle".equals(portName)) {
            setIPocHandleEndpointAddress(address);
        }
        else 
{ // Unknown Port Name
            throw new javax.xml.rpc.ServiceException(" Cannot set Endpoint Address for Unknown Port" + portName);
        }
    }

    /**
    * Set the endpoint address for the specified port name.
    */
    public void setEndpointAddress(javax.xml.namespace.QName portName, java.lang.String address) throws javax.xml.rpc.ServiceException {
        setEndpointAddress(portName.getLocalPart(), address);
    }

}
